package setting

import (
	"gitee.com/wanjimao/dongli-kit/pkg/config"
	"go.uber.org/fx"
)

type Param struct {
	fx.In
	EnvServer string `name:"EnvServer"`
}

type Result struct {
	fx.Out
	config.EnvironmentBlock
	EnvServer string `name:"EnvServer" envconfig:"ENV_SERVER" default:"local"` //当前的环境，local,dev,test,pro
}

func (g *Result) LoadFromEnv() (err error) {
	err = config.Load(g)
	return
}

var Module = fx.Module("settings", fx.Provide(
	func() (out Result, err error) {
		err = out.LoadFromEnv()
		return
	},
),
)
